{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=304
  Verdict: Accepted
}
var n,a,b,c:int64;
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(n);
a:=0;
b:=0;
c:=0;
c:=n div 60;
n:=n mod 60;
if n>=35 then begin
	inc(c);
	n:=0;
end else begin
	b:=n div 10;
	n:=n mod 10;
	if n>=9 then begin
		inc(b);
		n:=0;
	end else a:=n;
end;
writeln(a,' ',b,' ',c);
end.